<!-- START PAGE -->
        <div id="page">


            <!-- start page title -->

                <div class="page-title">
                	<div class="in">
                   	<div class="titlebar">	<h2><?php echo $template['title']?></h2>	<p>This is a quick overview of <?php echo $template['title']?></p></div>

                    </div>
                </div>
                <!-- end page title -->

            <!-- START CONTENT -->
            <div class="content">
                <!-- START SIMPLE FORM -->
                        	<div class="simplebox grid740">
                            	<div class="titleh">
                                	<h3><?php echo $template['title']?></h3>
                                 </div>
                                <div class="body">

                                  <form id="form_add" name="form2" method="post" action="<?php echo $link_action?>" enctype="multipart/form-data">

                                  	<div class="st-form-line">
                                    	<span class="st-labeltext">Tên menu</span>
                                        <input name="name" id="name" type="text" class="st-forminput" style="width:510px" value="<?=$items['men_name']?>" />
                                        <span style="margin-left: 160px; color:#ff0000"><?php echo form_error('name'); ?></span>
                                    	<div class="clear"></div>
                                   </div>

                                    <div class="st-form-line">
                                    	<span class="st-labeltext">Nhập url</span>
                                        <input name="link" id="link" type="text" class="st-forminput" style="width:510px" value="<?=$items['link']?>" />
                                        <span style="margin-left: 160px; color:#ff0000"><?php //echo form_error('name'); ?></span>
                                    	<div class="clear"></div>
                                   </div>
                                   <div class="st-form-line">	<span class="st-labeltext">Hoặc chọn danh mục</span>
                                        <select name="link_cat" id="link_cat" class="uniform">
                                            <option value=""  selected="selected">[Chọn danh mục]</option>
                                            <?php if(count($cates)) : ?>
											<?php foreach($cates as $cate) : ?>
												<?php $link = "danh-muc/" .$cate['id'] . "-" . $this->util->alias($cate['cat_name']); ?>
												<option value="<?=$link?>" <?php if($items['link_cat'] == $link)  echo "selected=selected";?>><?=$cate['cat_name']?></option>
											<?php endforeach ?>
											<?php endif ?>
                                        </select>
                                        <br><span style="margin-left: 160px; color:#ff0000"><?php //echo form_error('link_cat'); ?></span>
                                    	<div class="clear"></div>
                                    </div>
                                    <div class="st-form-line">
                                    	<span class="st-labeltext">Sắp xếp</span>
                                        <input name="order" id="order" type="text" class="st-forminput" placeholder="1" style="width:50px" value="<?=$items['order']?>" />
                                        <span style="margin-left: 160px; color:#ff0000"><?php echo form_error('order'); ?></span>
                                    	<div class="clear"></div>
                                    </div>
                                    <div class="st-form-line">	<span class="st-labeltext">Published</span>
                                        <select name="status" id="status" class="uniform">
                                            <?php if($items['status'] == 1) : ?>
                                            	<option value="1" selected="selected">Yes</option>
                                            <?php else :?>
                                            	<option value="1" selected="selected">Yes</option>
                                            <?php endif ?>
                                            <?php if($items['status'] == 0) : ?>
                                            	<option value="0" selected="selected">No</option>
                                            <?php else :?>
                                            	<option value="0">No</option>
                                            <?php endif ?>
                                        </select>
                                    	<div class="clear"></div>
                                    </div>

                                    <div class="button-box">
                                   	  <input type="button" onclick="$('#form_add').submit()" name="button" id="button" value="Submit" class="st-button"/>
                                   	  <input type="button" name="button" id="button2" value="Cancel" onclick="location.href='<?php echo $link_cancel?>'" class="st-clear"/>
                                    </div>

                                  </form>

                                </div>
                            </div>
                        <!-- END SIMPLE FORM -->

            </div>
            <!-- END CONTENT -->
        </div>
        <!-- END PAGE -->

    <div class="clear"></div>
<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery('#sidemenu ul li.active').removeClass('active');
		jQuery('#m_menu').addClass('active');
	});
</script>

<script type="text/javascript">

	tinyMCE.init({
    // General options
    mode : "exact",
    elements : "long_desc",
    theme : "advanced",
    skin : "o2k7",
    relative_urls : false,
    plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,pastetext,pasteword,bullist,numlist,|,formatselect,fontselect,fontsizeselect, forecolor,backcolor,fullscreen",
    theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,justifyfull,fontselect,blockquote,|,undo,redo,|,link,unlink,image,media,|,code,preview",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    file_browser_callback: "ajaxfilemanager",

    /* Example content CSS (should be your site CSS)
    content_css : "css/content.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",
    */
    // Replace values for the template plugin
    template_replace_values : {
        username : "Some User",
        staffid : "991234"
    }
    });

function ajaxfilemanager(field_name, url, type, win) {
    var ajaxfilemanagerurl = "<?=base_url();?>tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php";
    switch (type) {
        case "image":
                break;
        case "media":
                break;
        case "flash":
                break;
        case "file":
                break;
        default:
            return false;
    }
    tinyMCE.activeEditor.windowManager.open({
        url: "<?=base_url();?>tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php",
        width: 782,
        height: 400,
        inline : "yes",
        close_previous : "no"
    },{
        window : win,
        input : field_name
    });

}


</script>
